package alogrithm.bigdata.phonenumbersort;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.Random;

public class BigPhoneNumberCreator {
	public void create(String fileName,int length,int seed)throws Exception{
		Random random=new Random();
		BufferedWriter writer=new BufferedWriter(new FileWriter(new File(fileName)));
		int writed=0;
		while(writed<length){
			writer.append(String.valueOf(random.nextInt(seed)));
			writer.append("\n");
			if(writed%1024*1024==0){
				writer.flush();
			}
			writed++;
		}
		writer.flush();
		writer.close();
	}
	
	public static void main(String[] args) throws Exception{
		//new BigPhoneNumberCreator().create("c:/phone.txt", 100000000, 1000000000);
		System.out.println(100000000D*4/1024d/1024d/32);
	}
}
